Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(teams): resolve undefined variable error and add logging #6290

Merged
merged 1 commit into from
Nov 11, 2024

Conversation

miaulalala
Copy link
Contributor

@miaulalala miaulalala commented Aug 26, 2024

Signed-off-by: Anna Larch anna@nextcloud.com

Copy link

codecov bot commented Aug 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 23.47%. Comparing base (a9b6627) to head (9d1688c).
Report is 24 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #6290      +/-   ##
============================================
- Coverage     23.47%   23.47%   -0.01%     
+ Complexity      454      453       -1     
============================================
  Files           247      247              
  Lines         11708    11712       +4     
  Branches       2223     2222       -1     
============================================
  Hits           2749     2749              
- Misses         8639     8643       +4     
  Partials        320      320              
Flag Coverage Δ
javascript 15.05% <ø> (ø)
php 59.31% <ø> (-0.11%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@miaulalala miaulalala marked this pull request as ready for review September 5, 2024 19:35
@miaulalala miaulalala self-assigned this Sep 5, 2024
@miaulalala miaulalala added the 3. to review Waiting for reviews label Sep 5, 2024
@miaulalala miaulalala added this to the v5.0.1 milestone Sep 5, 2024
@miaulalala
Copy link
Contributor Author

/backport to stable5.0

@backportbot backportbot bot added the backport-request A backport was requested for this pull request label Sep 5, 2024
@miaulalala
Copy link
Contributor Author

/backport to stable4.7

@miaulalala miaulalala added the bug label Sep 5, 2024
*
* @NoAdminRequired
*/
public function getCircleMembers(string $circleId):JSONResponse {
if (!$this->appManager->isEnabledForUser('circles') || !class_exists('\OCA\Circles\Api\v1\Circles')) {
if (!class_exists('\OCA\Circles\Api\v1\Circles') || !$this->appManager->isEnabledForUser('circles')) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question, why are we checking if the class exists? Would the check for isEnabledForUser not be sufficient enough to determine if the circles app is installed, enabled on the system and permitted for this user?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original pr mentions a problem with Psalm #5420 (review) ;)

I haven't done any profiling but would expect, especially now with the flipped condition, a little performance gain for systems without circles.

isEnabledForUser does a lot (fetch the installed app versions for all apps, see if the app is installed, fetch the user session, fetch the groups for a user, see if the user has a group that the app is enabled for).

Copy link
Contributor

@SebastianKrupinski SebastianKrupinski Sep 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isEnabledForUser does a lot (fetch the installed app versions for all apps, see if the app is installed, fetch the user session, fetch the groups for a user, see if the user has a group that the app is enabled for).

I checked the code... Thats not the case, I think the original author just didn't know there was a build in function to see if the app was enabled, and checked for the existence for the class instead.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thats not the case

What is not the case?

@miaulalala miaulalala modified the milestones: v5.0.1, 5.0.2, v5.1.0 Oct 14, 2024
@miaulalala miaulalala force-pushed the fix/undefined-variable-contracts-controller branch from adef3c9 to 56ca9af Compare November 4, 2024 13:00
Signed-off-by: Anna Larch <anna@nextcloud.com>
@miaulalala miaulalala force-pushed the fix/undefined-variable-contracts-controller branch from 56ca9af to 9d1688c Compare November 4, 2024 13:02
@st3iny st3iny merged commit 04b1204 into main Nov 11, 2024
35 of 36 checks passed
@st3iny st3iny deleted the fix/undefined-variable-contracts-controller branch November 11, 2024 09:11
@backportbot backportbot bot removed the backport-request A backport was requested for this pull request label Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews bug
Projects
Status: ☑️ Done
Development

Successfully merging this pull request may close these issues.

4 participants